<template>
  <div class="box">
    <h2>虚拟用户管理，手工增加已登录或未登录的用户数量</h2>
        <div>
          <label for="login">登录用户</label>
          <input type="radio" name="flag" checked id="login" @click="flag=true"/>
          </div>
       <div>
          <label for="notlogin">未登录用户</label>
          <input type="radio" name="flag"  id="notlogin" @click="flag=false"/>
       </div>

        <input type="number" v-model="num"/>
       <button @click="addLogNum">增加</button>
 </div>
  </template>
  <script>
  export default {
    name: 'addNum',
    data() {
      return {
        flag: true,
        num:0
      }
    },
 computed:{
    loginNum:function(){ return this.$store.getters.allNum}
  },
  mounted(){
    this.num=this.loginNum;
  },
  methods:{
     addLogNum(){
       console.log(this.flag);
        this.$store.commit('addLogNum',{loginNum:parseInt(this.num),flag:this.flag});
    }
   }
  }
  </script>
  <style scoped>
    .box>div{
      display:inline-block;
      margin:10px;
      padding:10px;
      border:1px dashed #ccc;
    }

  </style>
